package net.gyapp.markim.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import net.gyapp.markim.core.entity.ConversationEntity;
import net.gyapp.markim.core.entity.FriendsEntity;
import net.gyapp.markim.core.entity.GroupEntity;
import net.gyapp.markim.core.entity.MemberEntity;
import net.gyapp.markim.core.entity.MessageEntity;
import net.gyapp.markim.core.entity.UserEntity;

import net.gyapp.markim.dao.ConversationEntityDao;
import net.gyapp.markim.dao.FriendsEntityDao;
import net.gyapp.markim.dao.GroupEntityDao;
import net.gyapp.markim.dao.MemberEntityDao;
import net.gyapp.markim.dao.MessageEntityDao;
import net.gyapp.markim.dao.UserEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig conversationEntityDaoConfig;
    private final DaoConfig friendsEntityDaoConfig;
    private final DaoConfig groupEntityDaoConfig;
    private final DaoConfig memberEntityDaoConfig;
    private final DaoConfig messageEntityDaoConfig;
    private final DaoConfig userEntityDaoConfig;

    private final ConversationEntityDao conversationEntityDao;
    private final FriendsEntityDao friendsEntityDao;
    private final GroupEntityDao groupEntityDao;
    private final MemberEntityDao memberEntityDao;
    private final MessageEntityDao messageEntityDao;
    private final UserEntityDao userEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        conversationEntityDaoConfig = daoConfigMap.get(ConversationEntityDao.class).clone();
        conversationEntityDaoConfig.initIdentityScope(type);

        friendsEntityDaoConfig = daoConfigMap.get(FriendsEntityDao.class).clone();
        friendsEntityDaoConfig.initIdentityScope(type);

        groupEntityDaoConfig = daoConfigMap.get(GroupEntityDao.class).clone();
        groupEntityDaoConfig.initIdentityScope(type);

        memberEntityDaoConfig = daoConfigMap.get(MemberEntityDao.class).clone();
        memberEntityDaoConfig.initIdentityScope(type);

        messageEntityDaoConfig = daoConfigMap.get(MessageEntityDao.class).clone();
        messageEntityDaoConfig.initIdentityScope(type);

        userEntityDaoConfig = daoConfigMap.get(UserEntityDao.class).clone();
        userEntityDaoConfig.initIdentityScope(type);

        conversationEntityDao = new ConversationEntityDao(conversationEntityDaoConfig, this);
        friendsEntityDao = new FriendsEntityDao(friendsEntityDaoConfig, this);
        groupEntityDao = new GroupEntityDao(groupEntityDaoConfig, this);
        memberEntityDao = new MemberEntityDao(memberEntityDaoConfig, this);
        messageEntityDao = new MessageEntityDao(messageEntityDaoConfig, this);
        userEntityDao = new UserEntityDao(userEntityDaoConfig, this);

        registerDao(ConversationEntity.class, conversationEntityDao);
        registerDao(FriendsEntity.class, friendsEntityDao);
        registerDao(GroupEntity.class, groupEntityDao);
        registerDao(MemberEntity.class, memberEntityDao);
        registerDao(MessageEntity.class, messageEntityDao);
        registerDao(UserEntity.class, userEntityDao);
    }
    
    public void clear() {
        conversationEntityDaoConfig.clearIdentityScope();
        friendsEntityDaoConfig.clearIdentityScope();
        groupEntityDaoConfig.clearIdentityScope();
        memberEntityDaoConfig.clearIdentityScope();
        messageEntityDaoConfig.clearIdentityScope();
        userEntityDaoConfig.clearIdentityScope();
    }

    public ConversationEntityDao getConversationEntityDao() {
        return conversationEntityDao;
    }

    public FriendsEntityDao getFriendsEntityDao() {
        return friendsEntityDao;
    }

    public GroupEntityDao getGroupEntityDao() {
        return groupEntityDao;
    }

    public MemberEntityDao getMemberEntityDao() {
        return memberEntityDao;
    }

    public MessageEntityDao getMessageEntityDao() {
        return messageEntityDao;
    }

    public UserEntityDao getUserEntityDao() {
        return userEntityDao;
    }

}
